Fix gatherv overflow when the combined packed mesh size exceeds 2^31. #117
+60
−24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix gatherv overflow when the combined packed mesh size exceeds 2^31.
In this case, the array of displacements provided to
MPI_gatherv
overflow the INT32_MAX value while the function expect an array ofint32_t
.This PR follows on from the PRs #113 and #114 that have to be credited to @mpotse and @wissambouymedj.
Fix
The gatherv has been replaced by MPI_Send / Recv calls.
Validation
-DENABLE_GATHERV
, the program calls thegatherv
function, otherwise it calls thesend/recv
ones. The integer type of arraysdispls
andbuf_idx
as to be defined when building the program (-DINT_TYPE=int
or-DINT_TYPE=
size_t`)INT_TYPE
defined tosize_t
we can obxerve the gatherv failure while thesend/recv
messages succeed.Todo
The mesh packing inside a char array implies that we need large intergers to store the message size. An alternative that was implemented in the past (and was working I think) used hierarchical
MPI_Struct
to define the C structures used in the mesh (points, xpoints, tetra...) as well as the mesh itself. It should allow to easier the mesh communication and to reduce the size of the integer used to provide the message size (because the MPI structures will be larger than chars which is the minimal unit for the type of variables).See issue #118